import { jsCallJavaAbility } from '../../../common/JsCallJavaAbilityUtils.js';

export default {
    data: {
        text: "",
        iskey:false
    },
    start() {
        jsCallJavaAbility.callAbility("ControllerAbility",100,{}).then(result=>{
            console.log(result)
        })
        console.info("开始")
    },
    stop() {
        jsCallJavaAbility.callAbility("ControllerAbility",101,{}).then(result=>{
            console.log(result)
        })
        jsCallJavaAbility.unSubAbility("ControllerAbility",201).then(result=>{
            if (result.code == 200) {
                console.log("取消订阅成功");
            }
        })
        console.info("关闭订阅")
    },
    sub() {
        jsCallJavaAbility.subAbility("ControllerAbility", 200, (data) => {
            let text = data.data.text
            text && (this.text += text)
            if(this.text.indexOf("我想流转")>-1){
                this.iskey=true;
            }
        }).then(result => {
            if (result.code == 200) {
                console.log("订阅成功");
            }
        })
        console.info("开始订阅")
    }
}
